package jp.go.aist.six.test.util.castor;




/**
 * @author  Akihito Nakamura, AIST
 * @version $Id: ComplexEnum.java 73 2010-06-09 02:02:18Z nakamura5akihito $
 */
public enum ComplexEnum
{
    ALL( "all" ), AT_LEAST_ONE( "at least one" ), ONLY_ONE( "only one" );



    private final String  value;


    ComplexEnum( final String value )
    {
        this.value = value;
    }


    public static ComplexEnum fromValue(
                    final String value
                    )
    {
//        System.out.println( "ComplexEnum.fromValue: value=" + value );

        for (ComplexEnum  c : ComplexEnum.values()) {
//            if (ComplexEnum.valueOf( value ) == c) {
//            System.out.println( "  c.value=" + c.value );
            if (c.value.equals( value )) {
//                System.out.println( "ComplexEnum.fromValue: value found" );
                return c;
            }
        }

//        System.out.println( "ComplexEnum.fromValue: value NOT found !!!" );
        throw new IllegalArgumentException( value );
    }



    public String value() {
        return this.value;
    }


    public String toString() {
        return this.value;
    }

}
// ComplexEnum


